package com.softcits.hw;

import java.util.Date;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

@Configuration
@ComponentScan(basePackages= {"com.softcits.hw"})
@PropertySource("classpath:/app.properties")
public class HelloWorldConfig {
    
    @Value("${user}")
    private String user;
    
    @Value("${password}")
    private String password;
    
    public void outputProperties() {
        System.out.println(user);
        System.out.println(password);
    }

    @Bean(name="hw")
    @Qualifier("proto-type")
    public HelloWorld getHelloWorld() {
        return new HelloWorld();
    }
    
    @Bean
    public Date getDate() {
        return new Date();
    }
}
